* Dickstein, Ho, and Mark (2023)
* Create premarkup graphs, changes in risk aversion graphs as line graphs

cd ../..

global release = "release/heatmaps"

global build = "build/heatmaps"

shell mkdir -p "$release/stata_plots"

cap program drop set_grstyle
program define set_grstyle
	grstyle init
	grstyle set plain
end

*******************************************
* Create premarkup graph
use "$build/premarkup_counterfactual.dta", clear

set_grstyle
* saving the plot without the legend:
tw (scatter sg_change_cs_2 markup, msymbol(i) connect(L) lwidth(medthick) lcolor("black")) || ///
	(scatter im_change_cs_2 markup if premrkup == 0, msymbol(i) lpattern(dash) connect(l) lwidth(medthick) lcolor("black")) || ///
	(scatter im_change_cs_2 markup if premrkup == 0.25, msymbol(i) lpattern(shortdash) connect(l) lwidth(medthick) lcolor("black"))  ///
	, legend(off) ///
	ylab(0(20)80) ///
	xtitle("post-markup") ytitle("change in consumer surplus")
graph export "$release/stata_plots/premarkup_plot.eps", replace  

* saving the legend alone: 
replace sg_change_cs_2 = 0
replace markup = 0
tw (scatter sg_change_cs_2 markup, msymbol(i) connect(L) lwidth(medthick) lcolor("black")) || ///
	(scatter im_change_cs_2 markup if premrkup == 0, msymbol(i) lpattern(dash) connect(l) lwidth(medthick) lcolor("black")) || ///
	(scatter im_change_cs_2 markup if premrkup == 0.25, msymbol(i) lpattern(shortdash) connect(l) lwidth(medthick) lcolor("black"))  ///
	, legend(label(1 "Small group") label(2 "Individual: pre-markup = 0") label(3 "Individual: pre-markup = 0.25") region(lstyle(none))) ///
	 yscale(off) xscale(off)
gr_edit .plotregion1.draw_view.setstyle, style(no)
graph export "$release/stata_plots/premarkup_plot_legend.eps", replace  

